#!/usr/bin/expect
#获取用户密码
set passwd [lindex $argv 0]

# 设置escryptfs加密初始化
# spawn ecryptfs-setup-private --noautomount
spawn ecryptfs-setup-private
expect {
    "Enter your login passphrase*" {send "$passwd\r";exp_continue;}
    "Enter your mount passphrase*" {set timeout 500;send "\r";exp_continue;}
    "mv*" {set timeout 500;send "\r";exp_continue;}
}
#expect eof
